//
//  EventListCell.m
//  FootPrint
//
//  Created by alex tao on 3/26/13.
//  Copyright (c) 2013 alex tao. All rights reserved.
//

#import "EventListCell.h"

@implementation EventListCell


- (void)internalInit
{
    [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil];
    
    _realView.frame = self.bounds;
    [self.contentView addSubview:_realView];
    
    self.contentView.backgroundColor = [UIColor clearColor];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self internalInit];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void) updateWithEventInfo:(EventQueryResponseMessage_Summary*)event
{
    if ([event.imgUrl hasPrefix:@"sys_"]) {
        [_eventIcon setLocalImageName:event.imgUrl];
    } else {
        [_eventIcon loadAsyncImage:event.imgUrl];
    }
    _eventTitle.text = event.eventName;
    _eventLocation.text = event.merchantName;
    _eventTime.text = [GToolUtil dateStrFromDataFormat2:event.time];
}

- (void)dealloc {
    [_realView release];
    [_eventIcon release];
    [_eventTitle release];
    [_eventLocation release];
    [_eventTime release];
    [super dealloc];
}
@end
